<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var arr1 = [];
    for (var i = 1; i <= 25; i++) {
        arr1.push(i);
    }

    // console.log(arr1);
    var arr2 = [];
    var containerArr = [];
    for (var j = 0; j < arr1.length; j++) {
        // console.log(arr1[j]);
        var val = arr1[j];
        arr2.push(val);
        if (val % 5 == 0) {
            console.log(arr2);
            containerArr.push(arr2);
            arr2 = [];
        }
    }
    console.log(containerArr);
</script>

</html>